﻿Imports System.Data.SqlClient
Public Class frmPhongTrong
    Public Delegate Function mydel(ByVal s As String) As String
    Public md As mydel
    Private Sub frmPhongTrong_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim cnStr As String = "Data Source=.\SQLEXPRESS;Initial Catalog=QLKS;Integrated Security=True"
        Dim con As New SqlConnection(cnStr)
        Dim dt As New DataTable
        Dim bs As New BindingSource()
        Dim str As String = "Trống"
        Dim sql As String = "select TenPhong,MaLoaiPhong,TrangThai from Phong where TrangThai like N'%" + str + "%'"
        Dim da As New SqlDataAdapter(sql, con)
        da.Fill(dt)
        bs.DataSource = dt
        DataGridView1.DataSource = bs
    End Sub

    Private Sub DataGridView1_CellMouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseDoubleClick
        md.Invoke(DataGridView1.CurrentRow.Cells("TenPhong").Value.ToString())
        Me.Close()
    End Sub

   
    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
        Me.Close()
    End Sub
End Class